

def time_trans(now_time, create_time):
    seconds = int((now_time - create_time).total_seconds())
    print(now_time, create_time, seconds)
    years = seconds // (365 * 24 * 60 * 60)
    months = seconds // (60 * 60 * 24 * 30)
    days = seconds // (60 * 60 * 24)
    hours = seconds // (60 * 60)
    minutes = seconds // (60)
    if seconds <= 0:
        return '刚刚'
    if days >= 2:
        return create_time.strftime('%Y-%m-%d')
    # if years:
    #     return f'{years}年前'
    # if months:
    #     return f'{months}个月前'
    if days:
        return f'{days}天前'
    if hours:
        return f'{hours}小时前'
    if minutes:
        return f'{minutes}分钟前'
    return f'{seconds}秒前'


if __name__ == '__main__':
    print(time_trans(600))